DiscGolf.Models['golfer'] = Backbone.Model.extend( {

    urlRoot: [ '/', DiscGolf.applicationName, '/golfer' ].join(''),

    validate: function( attrs, options ) {

        if( attrs.password.length < 6 ) { return "Passwords need to be at least 6 characters"; }

        var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
    
        if( ! re.test( attrs.emailAddress ) ) { return "Invalid email address"; }
    }

} );
